/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class RetrieveAndUpdateCandidatosVEPDSData {
	public void retrieveAndUpdateTestData() throws PersistentException {
		PersistentTransaction t = orm_candidatos.CandidatosVEPDSPersistentManager.instance().getSession().beginTransaction();
		try {
			orm_candidatos.Candidatos lorm_candidatosCandidatos = orm_candidatos.CandidatosDAO.loadCandidatosByQuery(null, null);
			// Update the properties of the persistent object
			orm_candidatos.CandidatosDAO.save(lorm_candidatosCandidatos);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public void retrieveByCriteria() throws PersistentException {
		System.out.println("Retrieving Candidatos by CandidatosCriteria");
		orm_candidatos.CandidatosCriteria candidatosCriteria = new orm_candidatos.CandidatosCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//candidatosCriteria.id_candidato.eq();
		System.out.println(candidatosCriteria.uniqueCandidatos());
		
	}
	
	
	public static void main(String[] args) {
		try {
			RetrieveAndUpdateCandidatosVEPDSData retrieveAndUpdateCandidatosVEPDSData = new RetrieveAndUpdateCandidatosVEPDSData();
			try {
				retrieveAndUpdateCandidatosVEPDSData.retrieveAndUpdateTestData();
				//retrieveAndUpdateCandidatosVEPDSData.retrieveByCriteria();
			}
			finally {
				orm_candidatos.CandidatosVEPDSPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
